<span page-title ng-model="contentView">{{ 'Remove Content View ' | translate }} {{ contentView.name }}</span>

<div>
  <h3 translate>Remove {{ contentView.name }}</h3>

  <div ng-show="conflictingVersions.length > 0">
    <i class="fa fa-warning"></i>
    <span translate>
      {{ contentView.name }} cannot be deleted as one or more Content View Versions are still promoted to a Lifecycle Environment.
      Each Content View Version must be removed from their Lifecycle Environments before the Content View can be deleted.
    </span>

    <table class="table table-striped table-bordered">
      <thead>
        <tr>
          <th translate>Version</th>
          <th translate>Lifecycle Environments</th>
          <th translate>Actions</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="version in conflictingVersions">
          <td>{{ version.version }}</td>
          <td>{{ environmentNames(version).join(', ') }}</td>
          <td>
            <a ui-sref="content-view.version-deletion.environments({contentViewId: contentView.id, versionId: version.id})" ng-show="version.permissions.deletable">
              <button class="btn btn-default" type="button" >
                <span translate>Remove Version</span>
              </button>
            </a>
          </td>
        </tr>
      </tbody>
    </table>
  </div>

  <div ng-show="conflictingVersions.length === 0">
    <p translate>
      Are you sure you want to remove Content View "{{ contentView.name }}"?
    </p>

    <div ng-show="versions.length > 0">
      <i class="fa fa-warning"></i>
      <span translate translate-n="versions.length" translate-plural=" As part of this deletion, {{ versions.length }} Content View Versions will be deleted.">
        As part of this deletion, 1 Content View Version will be deleted.
      </span>
    </div>

    <button ng-disabled="working" type="button" class="btn btn-danger" ng-click="delete()" >
      <i class="fa fa-spinner fa-spin" ng-show="working"></i>
      <span translate>Remove</span>
    </button>

    <a ui-sref="content-view.versions" ng-disabled="working" class="btn btn-default"  translate role="button">
      Cancel
    </a>
  </div>
</div>
